// 创建Vue Router实例
import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '@/views/LoginView.vue'
import AdminView from '@/views/AdminView.vue'
import MerchantView from '@/views/MerchantView.vue'
import User_HomeView from '@/views/User_HomeView.vue'
import User_MerchantInfo from '@/views/User_MerchantInfo.vue'
import User_OrderListView from '@/views/User_OrderListView.vue'
import User_MessageView from '@/views/User_MessageView.vue'
import EditUserView from '@/views/EditUserView.vue' 
import DishDetailView from '@/views/DishDetailView.vue'
import Admin_UserAnalysis from '@/views/Admin_UserAnalysis.vue'
import User_StarInfo from '@/views/User_StarInfo.vue'
import Admin_Menu from '@/views/Admin_Menu.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: LoginView
    },
    {
      path: '/admin',
      name: 'admin',
      component: AdminView
    },
    {
      path: '/merchant',
      name: 'merchant',
      component: MerchantView
    },
    {
      path: '/user_home',
      name: 'user_home',
      component: User_HomeView
    },
    {
      path: '/user_merchantinfo/:id',   // 通过路由参数传递商家ID
      name: 'user_merchantinfo',
      component: User_MerchantInfo
    },
    {
      path: '/user_orderlist',
      name: 'user_orderlist',
      component: User_OrderListView
    },
    {
      path: '/user_message',
      name: 'user_message',
      component: User_MessageView
    },
    {
      path: '/edit_user/:id',
      name: 'edit_user',
      component: EditUserView
    },
    {
      path: '/dish_detail/:id',
      name: 'dish_detail',
      component: DishDetailView
    },
    {
      path: '/user_analysis',
      name: 'user_analysis',
      component: Admin_UserAnalysis
    },
    {
      path: '/user_starInfo',
      name: 'user_starInfo',
      component: User_StarInfo
    },
    {
      path: '/admin_menu',
      name: 'admin_menu',
      component: Admin_Menu
    },
  ]
})

export default router
